var UranusWei = angular.module("UranusWei");
/* 登录页 */
UranusWei.controller("login", ['$scope', '$rootScope', 'uranusiscroll', 'commonFactory', 'appconfig', '$timeout', 'CacheFactory', '$location','localStorageService', function ($scope, $rootScope, uranusiscroll, commonFactory, appconfig, $timeout, CacheFactory, $location,localStorageService) {
    var search = $location.search();
    var backPath = search.cp;
    $rootScope.Template = {
        title: '登录',
        state: 'login',
        showbackicon: false,
        backlink: backPath || "/main/home"
    }
    /* 找不到上一级页面，或者上一级页面是需要登录的情况下默认回到/main/home页 */
    commonFactory.setBackLink("/main/home", ["/mine/dqinvestrecords", "/mine"]);
    /* 如果用户已经登录，回到登录页面 */
    $scope.logininfo = {
        username: "",
        password: "",
        showpassword: false,
        clientId: localStorage.getItem('clientId'),
        geTuiAppId: localStorage.getItem('geTuiAppId')
    };

    /*登录方法 */
    $scope.login = function () {
        commonFactory.inputBlur();
        if (!$scope.logininfo.username) {
            commonFactory.messageshow({ content: "<div class='bg_tan'>请正确输入手机号</div>" });
            return;
        }
        if ($scope.logininfo.password == "") {
            commonFactory.messageshow({ content: "<div class='bg_tan'>请输入密码</div>" });
            return;
        }
        if (!$scope.logininfo.password || $scope.logininfo.password.length < 6 || $scope.logininfo.password.length > 20) {
            commonFactory.messageshow({ content: "<div class='bg_tan'>密码错误</div>" });
            return;
        }

        commonFactory.messageloading();
        commonFactory.ajax("/api/user/Login?clientId="+$scope.logininfo.clientId, { username: $scope.logininfo.username, tokenId: $rootScope.tokenId, password: $scope.logininfo.password, clientId: $scope.logininfo.clientId, geTuiAppId: $scope.logininfo.geTuiAppId }, function (result) {
            localStorageService.clearAll();
            if (result.code == 1) {
                commonFactory.messageclose();
                if (result.data.userInfo.userType == 3) {
                    var html = '<div id="js_singlePrice">';
                    html += '       <section class="withtan_box">';
                    html += '           <p class="clearfix witht_b_tit">';
                    html += '               <span class="text_center">&nbsp;提示</span>';
                    html += '           </p>';
                    html += '           <div class="withtan_content">';
                    html += '               <div class="clearfix with_c_div" style="padding-bottom:1.0667rem">';
                    html += '                   尊敬的用户：<br/><br/>';
                    html += '                   为了给您带来更优质的服务及体验，有利金服已于2018年2月4日完成系统升级。升级后系统变为双重资金监管模式。由于您的账户内有尚未投资过的金额，请您联系客服办理提现事宜。<br/><br/>';
                    html += '                   客服电话：400-600-3538<br/>';
                    html += '                   电话客服时间：9:00-18:00<br/>';
                    html += '                   微信搜索【有利金服】公众号，关注后即可在线联系客服<br/>';
                    html += '                   微信客服时间：9:00-22:00<br/>';
                    html += '               </div>';
                    html += '           </div>';
                    html += '       </section>';
                    html += '   </div>';
                    commonFactory.messageview(html, { width: 1, height: 1, shadeClose: true }, $scope);
                } else if (result.data.userInfo.userType == 1) {
                    commonFactory.messageshow({ content: "<div class='bg_tan'>虚拟人不能登录</div>" })
                } else {
                    var data = result.data;
                    CacheFactory.setUID(data.gid);
                    CacheFactory.setUser(data.userInfo);
                    $timeout(function () {
                        commonFactory.go(backPath || "/main/mine");
                    }, 50);
                }
            } else {
                commonFactory.messageclose();
                if (result.data) {
                    if (result.code == 1083) {
                        commonFactory.showTD($scope);
                        var Tdparent = document.querySelector('.td_bg');
                        Tdparent.parentNode.parentNode.style.background = "rgba(255,255,255,0)";
                    } else {
                        commonFactory.messageshow({ content: "<div class='bg_tan'>" + result.data + "</div>" });
                    }

                } else {
                    commonFactory.messageshow({ content: "<div class='bg_tan'>登录失败，请稍后再试</div>" });
                }
            }
        }, function () {
            commonFactory.messageclose();
            commonFactory.messageshow({ content: "<div class='bg_tan'>登录失败，请稍后再试</div>" });
        }, "post");

    }
    $scope.loginevent = function (e) {
        if (e.keyCode == 13) {
            $scope.login();
        }
    }
    var dthis = new uranusiscroll();
    var text = commonFactory.GetRandomPullAd();
    dthis.showtext({ downtext: text, opentext: text, loadingtext: text });
    uranusiscroll = dthis.init(false, false);
}]);

/* 注册页 */
UranusWei.controller("register", ['$scope', '$rootScope', 'uranusiscroll', 'commonFactory', 'appconfig', '$timeout', 'CacheFactory', '$interval', '$location', 'uranusPlus', function ($scope, $rootScope, uranusiscroll, commonFactory, appconfig, $timeout, CacheFactory, $interval, $location, uranusPlus) {
    if (!$rootScope.previousState || $rootScope.previousState.name == "main.home") {
        var backPath = "/main/home";
    }
    $rootScope.Template = {
        title: '注册',
        state: 'register',
        showbackicon: true,
        showheader: true,
        backlink: backPath || "/login/index"
    }
    if (!uranusPlus.isApp) {
        $scope.isGuidDown =1
    }
    $scope.closeguiddown=function(){
        $scope.isGuidDown =0
    }
    $scope.registerinfo = {
        agreeprotocol: true,/* 用户协议 */
        verifydjs: -1, //验证码倒计时
        verifymobile: "",
        showpassword: false,
        clientId: localStorage.getItem('clientId'),
        geTuiAppId: localStorage.getItem('geTuiAppId')
    };
    if (!$rootScope.previousState || $rootScope.Template.backlink == "") {
        $rootScope.Template.backlink = '/login/index';
    }
    /* 获取验证码 */
    $scope.getverifycode = function () {

        if ($scope.registerinfo.verifydjs < 0) {
            if (!$scope.registerinfo.username) {
                commonFactory.messageshow({ content: "<div class='bg_tan'>请正确输入手机号</div>" });
                return;
            }
            commonFactory.messageloading();
            commonFactory.ajax("/api/User/GetMobileVerifyCode", { mobile: $scope.registerinfo.username, IsExistUser: false, tokenId: $rootScope.afs_token}, function (result) {
                commonFactory.messageclose();
                if (result.code == 1) {
                    $scope.registerinfo.verifymobile = $scope.registerinfo.username;
                    $scope.registerinfo.verifydjs = 60;
                    var djs = $interval(function () {
                        $scope.registerinfo.verifydjs--;
                        if ($scope.registerinfo.verifydjs < 0) {
                            $interval.cancel(djs);
                        }
                    }, 1000);
                } else {
                    if (result.data) {
                        commonFactory.messageshow({ content: "<div class='bg_tan'>" + result.data + "</div>" });
                    } else {
                        if (result.code == 1083) {
                            commonFactory.showTD($scope);
                            var Tdparent = document.querySelector('.td_bg');
                            Tdparent.parentNode.parentNode.style.background = "rgba(255,255,255,0)";
                        } else {
                            commonFactory.messageshow({ content: "<div class='bg_tan'>获取短信验证码失败，请稍后再试</div>" });
                        }

                    }
                }
            }, function () {
                commonFactory.messageclose();
                commonFactory.messageshow({ content: "<div class='bg_tan'>获取短信验证码失败，请稍后再试</div>" });
            }, "post");
        }
    }
    /*注册方法 */
    $scope.register = function () {
        commonFactory.inputBlur();
        if (!$scope.registerinfo.username) {
            commonFactory.messageshow({ content: "<div class='bg_tan'>请正确输入手机号</div>" });
            return;
        }
        if (!$scope.registerinfo.password || $scope.registerinfo.password.length < 6 || $scope.registerinfo.password.length > 20) {
            commonFactory.messageshow({ content: "<div class='bg_tan'>请设置6-20位登录密码</div>" });
            return;
        }
        if ($scope.registerinfo.verifymobile == "") {
            commonFactory.messageshow({ content: "<div class='bg_tan'>请先获取短信验证码</div>" });
            return;
        }
        if ($scope.registerinfo.verifymobile != $scope.registerinfo.username) {
            commonFactory.messageshow({ content: "<div class='bg_tan'>获取验证码的手机号与注册手机号不一致</div>" });
            return;
        }
        if (!$scope.registerinfo.verifycode) {
            commonFactory.messageshow({ content: "<div class='bg_tan'>短信验证码错误</div>" });
            return;
        }
        if (!$scope.registerinfo.agreeprotocol) {
            commonFactory.messageshow("<div class='bg_tan'>请先同意有利金服用户协议</div>");
            return;
        }
        commonFactory.messageloading();
        commonFactory.ajax("/api/user/Register", { userfromid: 0, invitationcode:'', username: $scope.registerinfo.username, password: $scope.registerinfo.password, verifycode: $scope.registerinfo.verifycode, clientId: $scope.registerinfo.clientId, geTuiAppId: $scope.registerinfo.geTuiAppId, tokenId: $rootScope.afs_token }, function (result) {
            commonFactory.messageclose();
            if (result.code == 1) {
                var data = result.data;
                CacheFactory.setUID(data.gid);
                CacheFactory.setUser(data.userInfo);
                $timeout(function () {
                    commonFactory.go("/register/registersuccess");
                }, 50);
            } else {
                if (result.code == 1083) {
                    commonFactory.showTD($scope);
                    var Tdparent = document.querySelector('.td_bg');
                    Tdparent.parentNode.parentNode.style.background = "rgba(255,255,255,0)";
                } else {
                    commonFactory.messageshow({ content: "<div class='bg_tan'>" + result.data + "</div>" });
                }
            }
        }, function () {
            commonFactory.messageclose();
            commonFactory.messageshow({ content: "<div class='bg_tan'>注册失败，请稍后再试</div>" });
        }, "post")
    }
    $scope.loginevent = function (e) {
        if (e.keyCode == 13) {
            $scope.register();
        }
    }
    var dthis = new uranusiscroll();
    var text = commonFactory.GetRandomPullAd();
    dthis.showtext({ downtext: text, opentext: text, loadingtext: text });
    uranusiscroll = dthis.init(false, false);

    $scope.imgload = function () {
        $timeout(function () {
            uranusiscroll.refresh();
        }, appconfig.pulldowntime);
    }
}]);
/* 修改登录密码 */
UranusWei.controller("modifypassword", ['$scope', '$rootScope', 'uranusiscroll', 'commonFactory', 'appconfig', '$timeout', 'CacheFactory', '$location', '$interval', function ($scope, $rootScope, uranusiscroll, commonFactory, appconfig, $timeout, CacheFactory, $location, $interval) {
    var search = $location.search();
    var backPath = search.cp;
    $rootScope.Template = {
        title: '修改密码',
        state: 'modifypassword',
        showbackicon: true,
        showheader: false,
    }
    /* 找不到上一级页面，或者上一级页面是需要登录的情况下默认回到/main/home页 */
    var backmainarr = [];
    if (!$rootScope.previousState || ($rootScope.previousState && backmainarr.indexOf($rootScope.previousState.name.toLowerCase()) > -1)) {
        $rootScope.Template.backlink = "/main/home";
    }
    if (backPath) {
        $rootScope.Template.backlink = backPath;
    }
    commonFactory.messageloading({ process: true });
    $scope.userinfo = CacheFactory.getUser();
    if (!$scope.userinfo || $scope.userinfo == null) {
        commonFactory.go("/login/index");
        return;
    }
    commonFactory.messageclose();

    /* 如果用户已经登录，回到登录页面 */
    $scope.modify = {
        verifydjs: -1,/* 倒计时 */
        isgetverifycode: false, /* 是否已经获取验证码 */
        showpassword: false
    };
    /* 获取短信验证码 */
    $scope.getverifycode = function () {
        if ($scope.modify.verifydjs < 0) {
            commonFactory.messageloading();
            commonFactory.ajax("/api/User/GetMobileVerifyCode", { mobile: $scope.userinfo.userName, IsExistUser: true, tokenId: $rootScope.afs_token, isModify: true }, function (result) {
                commonFactory.messageclose();
                if (result.code == 1) {
                    $scope.modify.verifydjs = 60;
                    $scope.modify.isgetverifycode = true;
                    var djs = $interval(function () {
                        $scope.modify.verifydjs--;
                        if ($scope.modify.verifydjs < 0) {
                            $interval.cancel(djs);
                        }
                    }, 1000);
                } else {
                    if (result.code == 1083) {
                        commonFactory.showTD($scope);
                        var Tdparent = document.querySelector('.td_bg');
                        Tdparent.parentNode.parentNode.style.background = "rgba(255,255,255,0)";
                    } else {
                        commonFactory.messageshow({ content: "<div class='bg_tan'>获取短信验证码失败，请稍后再试</div>" });
                    }
                }
            }, function () {
                commonFactory.messageclose();
                commonFactory.messageshow({ content: "<div class='bg_tan'>获取短信验证码失败，请稍后再试</div>" });
            }, "post");
        }
    }
    /*修改密码 */
    $scope.modifypassword = function () {
        if (!$scope.modify.isgetverifycode) {
            commonFactory.messageshow({ content: "<div class='bg_tan'>请先获取短信验证码</div>" });
            return;
        }
        if (!$scope.modify.verifycode) {
            commonFactory.messageshow({ content: "<div class='bg_tan'>短信验证码错误</div>" });
            return;
        }
        if (!$scope.modify.newpassword || $scope.modify.newpassword.length < 6 || $scope.modify.newpassword.length > 20) {
            commonFactory.messageshow({ content: "<div class='bg_tan'>请设置6-20位登录密码</div>" });
            return;
        }
        if ($scope.modify.newpassword != $scope.modify.enterpassword) {
            commonFactory.messageshow({ content: "<div class='bg_tan'>两次新密码输入不一致</div>" });
            return;
        }
        commonFactory.messageloading();
        commonFactory.ajax("/api/User/ModifyPassword", { userName: $scope.userinfo.userName, verifycode: $scope.modify.verifycode, password: $scope.modify.newpassword, tokenId: $rootScope.tokenId }, function (result) {
            commonFactory.messageclose();
            if (result.code == 1) {
                commonFactory.messageshow({ content: "<div class='bg_tan'>密码修改成功</div>" });
                CacheFactory.removestorage("user"); //清除用户信息
                $timeout(function () {
                    commonFactory.go("/login/index");
                }, 1000);
            } else {
                if (result.data) {
                    commonFactory.messageshow({ content: "<div class='bg_tan'>" + result.data + "</div>" });
                } else {
                    commonFactory.messageshow({ content: "<div class='bg_tan'>密码修改失败，请稍后再试</div>" });
                }
            }
        }, function () {
            commonFactory.messageclose();
            commonFactory.messageshow({ content: "<div class='bg_tan'>密码修改失败，请稍后再试</div>" });
        }, "post");
    }
    // $scope.chinese = function ( password ) {
    //     var reg = new RegExp("[\\u4E00-\\u9FFF]+", "g");
    //     if (reg.test(password)) {
    //         var NoData = password.replace(/[^\u4E00-\u9FA5]/g, '');
    //         password = password.replace(NoData, '');
    //     }
    // }
    var dthis = new uranusiscroll();
    var text = commonFactory.GetRandomPullAd();
    dthis.showtext({ downtext: text, opentext: text, loadingtext: text });
    uranusiscroll = dthis.init(false, false);
    uranusiscroll.pullDownAction = function () {
        text = commonFactory.GetRandomPullAd();
        dthis.showtext({ downtext: text, opentext: text, loadingtext: text });
        $timeout(function () {
            uranusiscroll.refresh();
        }, appconfig.pulldowntime);
    }
}]);

/* 找回密码 findpassword */
UranusWei.controller("findpassword", ['$scope', '$rootScope', 'uranusiscroll', 'commonFactory', 'appconfig', '$timeout', 'CacheFactory', '$interval', function ($scope, $rootScope, uranusiscroll, commonFactory, appconfig, $timeout, CacheFactory, $interval) {
    $rootScope.Template = {
        title: '找回密码',
        state: 'findpassword',
        showbackicon: true,
        showheader: true,
        backlink: ''
    }
    $scope.modifyinfo = {
        showpassword: false,
        verifydjs: -1,
        verifymobile: "",
        verifycode: "",
        password: ""
    }

    /*获取验证码*/
    $scope.getverifycode = function () {
        if ($scope.modifyinfo.verifydjs < 0) {
            if (!$scope.modifyinfo.username) {
                commonFactory.messageshow({ content: "<div class='bg_tan'>请正确输入手机号</div>" });
                return;
            }
            commonFactory.messageloading();
            commonFactory.ajax("/api/User/GetMobileVerifyCode", { mobile: $scope.modifyinfo.username, IsExistUser: true, tokenId: $rootScope.afs_token }, function (result) {
                commonFactory.messageclose();
                if (result.code == 1) {
                    $scope.modifyinfo.verifymobile = $scope.modifyinfo.username;
                    $scope.modifyinfo.verifydjs = 60;
                    var djs = $interval(function () {
                        $scope.modifyinfo.verifydjs--;
                        if ($scope.modifyinfo.verifydjs < 0) {
                            $interval.cancel(djs);
                        }
                    }, 1000);
                } else {
                    if (result.data) {
                        commonFactory.messageshow({ content: "<div class='bg_tan'>" + result.data + "</div>" });
                    } else {
                        if (result.code == 1083) {
                            commonFactory.showTD($scope);
                            var Tdparent = document.querySelector('.td_bg');
                            Tdparent.parentNode.parentNode.style.background = "rgba(255,255,255,0)";
                        } else {
                            commonFactory.messageshow({ content: "<div class='bg_tan'>获取短信验证码失败，请稍后再试</div>" });
                        }
                    }
                }
            }, function () {
                commonFactory.messageclose();
                commonFactory.messageshow({ content: "<div class='bg_tan'>获取短信验证码失败，请稍后再试</div>" });
            }, "post");
        }
    }

    $scope.findpassword = function () {
        if (!$scope.modifyinfo.username) {
            commonFactory.messageshow({ content: "<div class='bg_tan'>请正确输入手机号</div>" });
            return;
        }
        if (!$scope.modifyinfo.verifymobile) {
            commonFactory.messageshow({ content: "<div class='bg_tan'>请先获取短信验证码</div>" });
            return;
        }
        if (!$scope.modifyinfo.verifycode) {
            commonFactory.messageshow({ content: "<div class='bg_tan'>短信验证码错误</div>" });
            return;
        }
        if (!$scope.modifyinfo.password || $scope.modifyinfo.password.length < 6 || $scope.modifyinfo.password.length > 20) {
            commonFactory.messageshow({ content: "<div class='bg_tan'>请设置6-20位登录密码</div>" });
            return;
        }

        commonFactory.messageloading();
        commonFactory.ajax("/api/User/ModifyPassword", { userName: $scope.modifyinfo.username, verifycode: $scope.modifyinfo.verifycode, password: $scope.modifyinfo.password, tokenId: $rootScope.tokenId }, function (result) {
            commonFactory.messageclose();
            if (result.code == 1) {
                commonFactory.messageshow({ content: "<div class='bg_tan'>密码修改成功，3秒后跳转登录</div>" });
                $timeout(function () {
                    commonFactory.go("/login/index");
                }, 2500);
            } else {
                if (result.data) {
                    commonFactory.messageshow({ content: "<div class='bg_tan'>" + result.data + "</div>" });
                } else {
                    commonFactory.messageshow({ content: "<div class='bg_tan'>获取短信验证码失败，请稍后再试</div>" });
                }
            }
        }, function () {
            commonFactory.messageclose();
            commonFactory.messageshow({ content: "<div class='bg_tan'>获取短信验证码失败，请稍后再试</div>" });
        }, "post");

    }
}]);

/* 安全密钥锁屏页面 */
UranusWei.controller("lockscreen", ['$scope', 'CacheFactory', 'uranusPlus', function ($scope, CacheFactory, uranusPlus) {
    $rootScope.isApp = true;//进入这个页面都是App
    CacheFactory.setH5Storage("isapp", "2");

    //关闭加载页面
    $rootScope.closeinitpage = function (callback) {
        if (!$rootScope.appinitsuccess) {
            setTimeout(function () {
                plus.webview.getLaunchWebview().evalJS("InitComplete()");
                $rootScope.appinitsuccess = true;
                if (callback) {
                    callback();
                }
            }, 0);
        }
    }
    // var deviceinfo = plus.device;
    // commonFactory.ajax("/api/user/RecordUserClientInfo", { clientid: info.clientid, gid: newguid, uuid: deviceinfo.uuid, model: deviceinfo.model, vendor: deviceinfo.vendor, packagetype: packagetype }, function (result) {
    // }, null, "post");
    uranusPlus.init(function () {
        /* 从个推推送进来的时候启动app */
        plus.push.addEventListener("click", function (msg) {
            if (plus.os.name == "iOS") {
                if (msg && msg.payload) {
                    var mypayload = msg.payload;
                    if (mypayload && mypayload.payload) {
                        mypayload = JSON.parse(mypayload.payload);
                        if (mypayload && mypayload.url) {
                            mainurl = mypayload.url;
                            //已经启动页面的话直接跳转
                            if ($rootScope.inputsavwpwd || !usesafepwd) {
                                commonFactory.go(mainurl);
                                return;
                            }
                        }
                    }
                }
            }
        }, false);
        /*穿透消息*/
        plus.push.addEventListener("receive", function (msg) {
            if (plus.os.name == "Android") {
                if (msg && msg.payload) {
                    var mypayload = JSON.parse(msg.payload);
                    if (mypayload.url) {
                        mainurl = mypayload.url;
                        //已经启动页面的话直接跳转
                        if ($rootScope.inputsavwpwd || !usesafepwd) {
                            commonFactory.go(mainurl);
                            return;
                        }
                    }
                }
            }


        }, false);
        $rootScope.closeinitpage();
        commonFactory.go(mainurl);
        // if (!usesafepwd) {
        //     commonFactory.go(mainurl);
        // } else {
        //     $rootScope.closeinitpage();
        // }
    });
}])

/* 注册成功页面 */
UranusWei.controller("registersuccess", ['$scope', '$rootScope', '$timeout', 'commonFactory', 'CacheFactory', 'appconfig', 'uranusiscroll', function ($scope, $rootScope, $timeout, commonFactory, CacheFactory, appconfig, uranusiscroll) {
    $rootScope.Template = {
        title: '注册成功',
        state: 'registersuccess',
        showbackicon: true,
        showheader: true,
        backlink: '/register/index'
    }
    var dthis = new uranusiscroll();
    var text = commonFactory.GetRandomPullAd();
    dthis.showtext({ downtext: text, opentext: text, loadingtext: text });
    uranusiscroll = dthis.init(false, false);
    $scope.imgload = function () {
        $timeout(function () {
            uranusiscroll.refresh();
        }, appconfig.pulldowntime);
    }

    $scope.redirectExper = function () {
        CacheFactory.setStorage("exper", "1");
        commonFactory.go("/mine/youliweal/experience");
    }
}]);

/* 有利金服用户协议 */
UranusWei.controller("servicedeal", ['$scope', '$rootScope', '$timeout', 'commonFactory', 'CacheFactory', 'appconfig', 'uranusiscroll', function ($scope, $rootScope, $timeout, commonFactory, CacheFactory, appconfig, uranusiscroll) {
    $rootScope.Template = {
        title: '访问失败',
        state: 'servicedeal',
        showbackicon: false,
        showheader: true
    }
    var backmainarr = ["productindex"];
    commonFactory.setBackLink("/main/home", backmainarr);
    var dthis = new uranusiscroll();
    var text = commonFactory.GetRandomPullAd();
    dthis.showtext({ downtext: text, opentext: text, loadingtext: text });
    uranusiscroll = dthis.init(true, false);
    uranusiscroll.pullDownAction = function () {
        text = commonFactory.GetRandomPullAd();
        dthis.showtext({ downtext: text, opentext: text, loadingtext: text });
        $timeout(function () {
            uranusiscroll.refresh();
        }, appconfig.pulldowntime);
    }
    $scope.imgload = function () {
        $timeout(function () {
            uranusiscroll.refresh();
        }, appconfig.pulldowntime);
    }
}]);
/*富民银行设置密码*/
UranusWei.controller("fmbankcardform", ['$scope', '$rootScope', '$timeout', 'commonFactory', 'CacheFactory', 'appconfig', 'uranusiscroll', '$http', '$stateParams', function ($scope, $rootScope, $timeout, commonFactory, CacheFactory, appconfig, uranusiscroll, $http, $stateParams) {
    $rootScope.Template = {
        title: '',
        state: 'fmbankcardform',
        showbackicon: false,
        showheader: true
    }
    var uid = $stateParams.uid;
    var dthis = new uranusiscroll();
    uranusiscroll = dthis.init(false, false);
    commonFactory.messageloading({ process: true });
    var data = { buyway: '01', u_id: uid };
    commonFactory.ajax("/api/Bank/FindTradePassword", data, function (result) {
        if (result.code == 1) {
            $scope.formdata = result.data;
            var formObject = document.querySelector('form')
            formObject.action = $scope.formdata.url
            $timeout(function () {
                formObject.submit();
            }, 50)
        }
    }, function () { }, 'post')

}]);